package com.sino.second.struts2;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;

import org.apache.struts2.ServletActionContext;

import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;

import com.opensymphony.xwork2.ActionSupport;
import com.sino.business.IBasicInfoService;
import com.sino.business.IJjxyInfoService;
import com.sino.business.IPatentManageService;
import com.sino.business.IQtzkService;
import com.sino.business.ISharePeopleService;
import com.sino.business.IZjclService;
import com.sino.business.IZlIntroService;
import com.sino.business.IZlbhzkService;
import com.sino.business.IZljszkService;
import com.sino.model.BasicInfoModel;
import com.sino.model.JjxyInfoModel;
import com.sino.model.QtzkModel;
import com.sino.model.SharePeopleModel;
import com.sino.model.TjyjModel;
import com.sino.model.ZjclModel;
import com.sino.model.ZlIntroModel;
import com.sino.model.ZlbhzkModel;
import com.sino.model.ZljszkModel;
import com.sino.util.Config;
import com.sino.util.DateUtils;
import com.sino.util.StringUtils;

public class ExportAction extends ActionSupport {
	/**
	 * 下载到本地的EXCEL文件名字
	 */
	private String fileName;

	private String excelPath;

	/**
	 * 下载的文件流
	 */
	private InputStream targetFile;

	private IZljszkService zljszkService = null;// 专利技术状况业务

	private IJjxyInfoService jjxyInfoService = null;// 经济效益总表一业务

	private IBasicInfoService basicInfoService = null;

	private IZlbhzkService zlbhzkService = null;

	private IQtzkService qtzkService = null;

	private ISharePeopleService sharePeoopleService = null;

	private IZjclService zjclService = null;// 证件材料

	private IPatentManageService patentManageService = null;// 推荐意见

	private IZlIntroService zlIntroService = null;// A3

	private ZljszkModel zljszkModel = null;// 专利技术状况

	private JjxyInfoModel jjxyInfoModel = null;// 经济效益总表一

	private BasicInfoModel basicInfoModel = null;

	private ZlbhzkModel zlbhzkModel = null; // 专利保护

	private QtzkModel qtzkModel = null; // 其它情况

	private SharePeopleModel sharePeopleModel = null;// 共有专利权人

	private ZjclModel zjclModel = null;

	private TjyjModel tjyjModel = null;// 推荐意见

	private ZlIntroModel zlIntroModel = null;// A3

	private String zlid = "";// ID

	public JjxyInfoModel getJjxyInfoModel() {
		return jjxyInfoModel;
	}

	public void setJjxyInfoModel(JjxyInfoModel jjxyInfoModel) {
		this.jjxyInfoModel = jjxyInfoModel;
	}

	public IJjxyInfoService getJjxyInfoService() {
		return jjxyInfoService;
	}

	public void setJjxyInfoService(IJjxyInfoService jjxyInfoService) {
		this.jjxyInfoService = jjxyInfoService;
	}

	public String getZlid() {
		return zlid;
	}

	public void setZlid(String zlid) {
		this.zlid = zlid;
	}

	public ZljszkModel getZljszkModel() {
		return zljszkModel;
	}

	public void setZljszkModel(ZljszkModel zljszkModel) {
		this.zljszkModel = zljszkModel;
	}

	public IZljszkService getZljszkService() {
		return zljszkService;
	}

	public void setZljszkService(IZljszkService zljszkService) {
		this.zljszkService = zljszkService;
	}

	/***************************************************************************
	 * 关于excel的操作 如下：
	 * 
	 * @throws Exception
	 */
	private File newFileByTemplet(String templet, String target) {

		// 创建目标文件
		File targetFile = new File(target);
		if (targetFile.exists()) {
			// 如果填报单位的文件已经生成直接返回
			return targetFile;
		} else {
			// 创建模板文件
			File templetFile = new File(templet);
			// 如果填报单位的文件没有生成，根据模板文件生成
			if (templetFile.exists()) {
				FileInputStream fis = null;
				FileOutputStream fos = null;
				try {
					fis = new FileInputStream(templetFile);
					fos = new FileOutputStream(targetFile);
					byte[] buf = new byte[1024];
					int i = 0;
					while ((i = fis.read(buf)) != -1) {
						fos.write(buf, 0, i);
					}
					fis.close();
					fos.close();
				} catch (Exception e) {
					try {
						throw new Exception("创建目标文件错误，导出EXCEL失败！");
					} catch (Exception e1) {
						// TODO Auto-generated catch block
						e1.printStackTrace();
					}
				}
			} else {
				try {
					throw new Exception("模板文件不存在，导出EXCEL失败！");
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		}
		return targetFile;
	}

	// 打印专利技术方法（2）
	public String findZljszkToPrint() throws Exception {
		if ("" == zlid) {
			zlid = (String) ServletActionContext.getRequest().getSession()
					.getAttribute("zlid2");
		}
		// 当前文件所在的跟目录
		String path = "/" + Config.findHomeDir();
		// 模板文件
		String templetfile = null;
		templetfile = path + "/teptFile/templet.xls";
		// 对应每个填报单位的文件
		String targetFile = path + "/teptFile2/" + zlid + ".xls";
		File exportFile = newFileByTemplet(templetfile, targetFile);
		Workbook rwb = null;
		WritableWorkbook book = null;
		try {
			rwb = Workbook.getWorkbook(exportFile);
			book = Workbook.createWorkbook(exportFile, rwb);
			/*******************************************************************
			 * 对第倒数第一个表(申报项目简介A3纸)
			 */
			this.setZlIntroModel(this.getZlIntroService().findZlintro(zlid));
			String a = this.getZlIntroModel().getMonth();
			WritableSheet sheet17 = book.getSheet(14);
			jxl.format.CellFormat cfWorkUnit38 = sheet17.getCell(11, 2)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit31 = sheet17.getCell(1, 2)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit32 = sheet17.getCell(2, 8)
					.getCellFormat();

			jxl.format.CellFormat cfWorkUnit33 = sheet17.getCell(0, 10)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit34 = sheet17.getCell(0, 24)
					.getCellFormat();

			jxl.format.CellFormat cfWorkUnit36 = sheet17.getCell(7, 5)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit37 = sheet17.getCell(7, 23)
					.getCellFormat();

			sheet17.addCell(new Label(1, 2, this.getZlIntroModel().getQxkw(),
					cfWorkUnit31));
			sheet17.addCell(new Label(1, 4, this.getZlIntroModel().getZlmc(),
					cfWorkUnit31));
			sheet17.addCell(new Label(5, 4, this.getZlIntroModel().getZlid2(),
					cfWorkUnit32));
			sheet17.addCell(new Label(1, 6, this.getZlIntroModel().getSbr(),
					cfWorkUnit31));
			sheet17.addCell(new Label(5, 6,
					this.getZlIntroModel().getSbrLxdh(), cfWorkUnit32));
			sheet17.addCell(new Label(2, 8,
					this.getZlIntroModel().getTjdwLxr(), cfWorkUnit32));
			sheet17.addCell(new Label(5, 8, this.getZlIntroModel()
					.getTjdwLxdh(), cfWorkUnit32));
			sheet17.addCell(new Label(0, 10, this.getZlIntroModel().getJsqk(),
					cfWorkUnit33));
			sheet17.addCell(new Label(0, 24, this.getZlIntroModel().getHjqk(),
					cfWorkUnit34));
			sheet17.addCell(new Label(7, 2, this.getZlIntroModel().getNd(),
					cfWorkUnit38));
			sheet17.addCell(new Label(9, 2, this.getZlIntroModel().getMonth(),
					cfWorkUnit38));
			sheet17.addCell(new Label(11, 2, this.getZlIntroModel().getDay(),
					cfWorkUnit38));
			sheet17.addCell(new Label(7, 5, this.getZlIntroModel().getShqk(),
					cfWorkUnit36));
			sheet17.addCell(new Label(7, 23, this.getZlIntroModel().getBhqk(),
					cfWorkUnit37));
			/*******************************************************************
			 * 对第个表(推荐意见表)
			 */

			this
					.setTjyjModel(this.getPatentManageService().getTjyjByZlid(
							zlid));
			WritableSheet sheet16 = book.getSheet(15);
			jxl.format.CellFormat cfWorkUnit30 = sheet16.getCell(1, 2)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit26 = sheet16.getCell(4, 16)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit28 = sheet16.getCell(3, 23)
					.getCellFormat();

			jxl.format.CellFormat cfWorkUnit29 = sheet16.getCell(2, 36)
					.getCellFormat();
			sheet16.addCell(new Label(1, 2, this.getTjyjModel().getTjyj(),
					cfWorkUnit30));
			sheet16.addCell(new Label(4, 16, this.getTjyjModel().getTjfzr(),
					cfWorkUnit26));
			sheet16.addCell(new Label(7, 17, this.getTjyjModel().getMtjnyr(),
					cfWorkUnit26));
			sheet16.addCell(new Label(3, 23, this.getTjyjModel().getYzm(),
					cfWorkUnit28));
			sheet16.addCell(new Label(7, 23, this.getTjyjModel().getYzm1(),
					cfWorkUnit28));

			sheet16.addCell(new Label(3, 25, this.getTjyjModel().getYzdw(),
					cfWorkUnit28));
			sheet16.addCell(new Label(7, 25, this.getTjyjModel().getYzdw1(),
					cfWorkUnit28));

			sheet16.addCell(new Label(3, 27, this.getTjyjModel().getLxdh(),
					cfWorkUnit28));
			sheet16.addCell(new Label(7, 27, this.getTjyjModel().getLxdh1(),
					cfWorkUnit28));

			sheet16.addCell(new Label(3, 29, this.getTjyjModel().getCz(),
					cfWorkUnit28));
			sheet16.addCell(new Label(7, 29, this.getTjyjModel().getCz1(),
					cfWorkUnit28));

			sheet16.addCell(new Label(3, 31, this.getTjyjModel().getTxdz(),
					cfWorkUnit28));
			sheet16.addCell(new Label(7, 31, this.getTjyjModel().getTxdz1(),
					cfWorkUnit28));

			sheet16.addCell(new Label(3, 33, this.getTjyjModel().getEmail(),
					cfWorkUnit28));
			sheet16.addCell(new Label(7, 33, this.getTjyjModel().getEmail1(),
					cfWorkUnit28));

			sheet16.addCell(new Label(2, 36, this.getTjyjModel().getMnyr(),
					cfWorkUnit29));
			sheet16.addCell(new Label(6, 36, this.getTjyjModel().getMNyr1(),
					cfWorkUnit29));
			/*******************************************************************
			 * 对第14个表(附件及证明资料)
			 */
			this.setZjclModel(this.getZjclService().findZjcl(zlid));
			WritableSheet sheet15 = book.getSheet(13);
			jxl.format.CellFormat cfWorkUnit24 = sheet15.getCell(3, 4)
					.getCellFormat();

			sheet15.addCell(new Label(3, 4, this.getZjclModel().getZlmc1(),
					cfWorkUnit24));
			sheet15.addCell(new Label(3, 5, this.getZjclModel().getZlmc2(),
					cfWorkUnit24));
			sheet15.addCell(new Label(3, 6, this.getZjclModel().getZlmc3(),
					cfWorkUnit24));
			sheet15.addCell(new Label(3, 7, this.getZjclModel().getZlmc4(),
					cfWorkUnit24));
			sheet15.addCell(new Label(3, 8, this.getZjclModel().getZlmc5(),
					cfWorkUnit24));
			sheet15.addCell(new Label(3, 9, this.getZjclModel().getZlmc6(),
					cfWorkUnit24));
			sheet15.addCell(new Label(3, 10, this.getZjclModel().getZlmc7(),
					cfWorkUnit24));
			sheet15.addCell(new Label(3, 11, this.getZjclModel().getZlmc8(),
					cfWorkUnit24));
			sheet15.addCell(new Label(3, 12, this.getZjclModel().getZlmc9(),
					cfWorkUnit24));
			sheet15.addCell(new Label(3, 13, this.getZjclModel().getZlmc10(),
					cfWorkUnit24));
			sheet15.addCell(new Label(3, 14, this.getZjclModel().getZlmc11(),
					cfWorkUnit24));
			sheet15.addCell(new Label(3, 15, this.getZjclModel().getZlmc12(),
					cfWorkUnit24));
			sheet15.addCell(new Label(3, 16, this.getZjclModel().getZlmc13(),
					cfWorkUnit24));
			sheet15.addCell(new Label(3, 17, this.getZjclModel().getZlmc14(),
					cfWorkUnit24));
			sheet15.addCell(new Label(3, 18, this.getZjclModel().getZlmc15(),
					cfWorkUnit24));
			sheet15.addCell(new Label(3, 19, this.getZjclModel().getZlmc16(),
					cfWorkUnit24));
			sheet15.addCell(new Label(3, 20, this.getZjclModel().getZlmc17(),
					cfWorkUnit24));
			sheet15.addCell(new Label(3, 21, this.getZjclModel().getZlmc18(),
					cfWorkUnit24));
			/*******************************************************************
			 * 对第13个表(共有专利权人)
			 */
			this.setSharePeopleModel(this.getSharePeoopleService()
					.findSharePeople(zlid));
			WritableSheet sheet14 = book.getSheet(12);
			jxl.format.CellFormat cfWorkUnit22 = sheet14.getCell(2, 11)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit23 = sheet14.getCell(7, 11)
					.getCellFormat();

			sheet14.addCell(new Label(2, 11, this.getSharePeopleModel()
					.getLxr1(), cfWorkUnit22));
			sheet14.addCell(new Label(2, 15, this.getSharePeopleModel()
					.getLxr2(), cfWorkUnit22));
			sheet14.addCell(new Label(2, 19, this.getSharePeopleModel()
					.getLxr3(), cfWorkUnit22));
			sheet14.addCell(new Label(2, 23, this.getSharePeopleModel()
					.getLxr4(), cfWorkUnit22));
			sheet14.addCell(new Label(2, 27, this.getSharePeopleModel()
					.getLxr5(), cfWorkUnit22));
			sheet14.addCell(new Label(2, 31, this.getSharePeopleModel()
					.getLxr6(), cfWorkUnit22));

			sheet14.addCell(new Label(7, 11, this.getSharePeopleModel()
					.getLxdh1(), cfWorkUnit23));
			sheet14.addCell(new Label(7, 15, this.getSharePeopleModel()
					.getLxdh2(), cfWorkUnit23));
			sheet14.addCell(new Label(7, 19, this.getSharePeopleModel()
					.getLxdh3(), cfWorkUnit23));
			sheet14.addCell(new Label(7, 23, this.getSharePeopleModel()
					.getLxdh4(), cfWorkUnit23));
			sheet14.addCell(new Label(7, 27, this.getSharePeopleModel()
					.getLxdh5(), cfWorkUnit23));
			sheet14.addCell(new Label(7, 31, this.getSharePeopleModel()
					.getLxdh6(), cfWorkUnit23));
			/*******************************************************************
			 * 对第12个表(其它状况)
			 */
			this.setQtzkModel(this.getQtzkService().findQtzk(zlid));
			WritableSheet sheet13 = book.getSheet(11);
			jxl.format.CellFormat cfWorkUnit20 = sheet13.getCell(0, 3)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit21 = sheet13.getCell(0, 21)
					.getCellFormat();
			sheet13.addCell(new Label(0, 3, this.getQtzkModel().getShgxinfo(),
					cfWorkUnit20));
			sheet13.addCell(new Label(0, 21, this.getQtzkModel().getQtinfo(),
					cfWorkUnit21));
			/*******************************************************************
			 * 对第11个表(专利保护状况)
			 */
			this.setZlbhzkModel(this.getZlbhzkService().findZlbhzkById(zlid));
			WritableSheet sheet12 = book.getSheet(10);
			jxl.format.CellFormat cfWorkUnit19 = sheet12.getCell(0, 8)
					.getCellFormat();
			sheet12.addCell(new Label(0, 8,
					this.getZlbhzkModel().getZlbhinfo(), cfWorkUnit19));
			/*******************************************************************
			 * 第一个表 主页
			 */
			this.setBasicInfoModel(this.getBasicInfoService()
					.findBasicinfoById(zlid));
			WritableSheet sheet88 = book.getSheet(0);
			jxl.format.CellFormat cfWorkUnit88 = sheet88.getCell(4, 27)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit89 = sheet88.getCell(4, 31)
					.getCellFormat();
			// 申报人
			sheet88.addCell(new Label(4, 27, this.getBasicInfoModel().getSbr(),
					cfWorkUnit88));

			String aaa = DateUtils.formatDateTime(this.getBasicInfoModel()
					.getSqrq(), DateUtils.FORMAT_DATE_YYYY_MM_DD);
			sheet88.addCell(new Label(4, 31, aaa.substring(0, 4) + "年"
					+ aaa.substring(5, 7) + "月" + aaa.substring(8, 10) + "日",
					cfWorkUnit89));

			/*******************************************************************
			 * 对第2个表(基本情况)
			 */
			this.setBasicInfoModel(this.getBasicInfoService()
					.findBasicinfoById(zlid));
			WritableSheet sheet11 = book.getSheet(1);
			jxl.format.CellFormat cfWorkUnit51 = sheet11.getCell(3, 2)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit52 = sheet11.getCell(1, 5)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit53 = sheet11.getCell(1, 6)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit54 = sheet11.getCell(5, 6)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit55 = sheet11.getCell(3, 13)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit56 = sheet11.getCell(1, 3)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit57 = sheet11.getCell(1, 10)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit58 = sheet11.getCell(1, 7)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit555 = sheet11.getCell(5, 14)
					.getCellFormat();
			// 专业
			if ("09".equals(this.getBasicInfoModel().getXk())
					&& null != this.getBasicInfoModel().getOtherXkName()) {
				sheet11.addCell(new Label(1, 3,
						this.getBasicInfoModel().getXkmc() + "("
								+ this.getBasicInfoModel().getOtherXkName()
								+ ")", cfWorkUnit56));
			} else {
				sheet11.addCell(new Label(1, 3, this.getBasicInfoModel()
						.getXkmc(), cfWorkUnit56));
			}
			sheet11.addCell(new Label(3, 2, this.getBasicInfoModel().getHymc(),
					cfWorkUnit51));
			sheet11.addCell(new Label(1, 5, this.getBasicInfoModel().getName(),
					cfWorkUnit52));
			sheet11.addCell(new Label(1, 6,
					this.getBasicInfoModel().getZlid2(), cfWorkUnit53));
			sheet11.addCell(new Label(5, 6, this.getBasicInfoModel()
					.getZltype(), cfWorkUnit54));
			// 申请日期
			sheet11.addCell(new Label(1, 7, this.getBasicInfoModel()
					.getZlSqrq(), cfWorkUnit58));
			// 授权日期
			sheet11.addCell(new Label(6, 7, DateUtils.formatDateTime(this
					.getBasicInfoModel().getZlrq(),
					DateUtils.FORMAT_DATE_YYYY_MM_DD), cfWorkUnit56));
			// 发明人
			sheet11.addCell(new Label(1, 8, this.getBasicInfoModel().getFmr(),
					cfWorkUnit52));
			// 专利权人
			sheet11.addCell(new Label(1, 9, this.getBasicInfoModel().getZlqr(),
					cfWorkUnit52));
			// 通讯地址
			sheet11.addCell(new Label(1, 10,
					this.getBasicInfoModel().getTxdz(), cfWorkUnit57));
			// 邮政编码
			sheet11.addCell(new Label(6, 10,
					this.getBasicInfoModel().getYzbm(), cfWorkUnit53));
			// 联系人
			sheet11.addCell(new Label(1, 11, this.getBasicInfoModel().getLxr()
					.toString(), cfWorkUnit53));
			// 联系电话
			sheet11.addCell(new Label(6, 11, this.getBasicInfoModel().getLxdh()
					.toString(), cfWorkUnit53));
			// 移动电话
			sheet11.addCell(new Label(1, 12, this.getBasicInfoModel().getYddh()
					.toString(), cfWorkUnit53));
			// email
			sheet11.addCell(new Label(6, 12, this.getBasicInfoModel()
					.getEmail(), cfWorkUnit53));
			// 许可单位
			sheet11.addCell(new Label(1, 14, this.getBasicInfoModel()
					.getXkdw1(), cfWorkUnit53));
			sheet11.addCell(new Label(1, 15, this.getBasicInfoModel()
					.getXkdw2(), cfWorkUnit53));
			sheet11.addCell(new Label(1, 16, this.getBasicInfoModel()
					.getXkdw3(), cfWorkUnit53));
			sheet11.addCell(new Label(1, 17, this.getBasicInfoModel()
					.getXkdw4(), cfWorkUnit53));
			sheet11.addCell(new Label(1, 18, this.getBasicInfoModel()
					.getXkdw5(), cfWorkUnit53));
			sheet11.addCell(new Label(1, 19, this.getBasicInfoModel()
					.getXkdw6(), cfWorkUnit53));
			sheet11.addCell(new Label(1, 20, this.getBasicInfoModel()
					.getXkdw1(), cfWorkUnit53));
			// 许可种类
			sheet11.addCell(new Label(3, 13, this.getBasicInfoModel()
					.getXktypemc1(), cfWorkUnit55));
			sheet11.addCell(new Label(3, 14, this.getBasicInfoModel()
					.getXktypemc2(), cfWorkUnit55));
			sheet11.addCell(new Label(3, 15, this.getBasicInfoModel()
					.getXktypemc3(), cfWorkUnit55));
			sheet11.addCell(new Label(3, 16, this.getBasicInfoModel()
					.getXktypemc4(), cfWorkUnit55));
			sheet11.addCell(new Label(3, 17, this.getBasicInfoModel()
					.getXktypemc5(), cfWorkUnit55));
			sheet11.addCell(new Label(3, 18, this.getBasicInfoModel()
					.getXktypemc6(), cfWorkUnit55));
			sheet11.addCell(new Label(3, 19, this.getBasicInfoModel()
					.getXktypemc6(), cfWorkUnit55));
			// 许可金额
			sheet11.addCell(new Label(5, 14, this.getBasicInfoModel()
					.getXkje1()
					+ "/" + this.getBasicInfoModel().getTc1(), cfWorkUnit555));
			sheet11.addCell(new Label(5, 15, this.getBasicInfoModel()
					.getXkje2()
					+ "/" + this.getBasicInfoModel().getTc2(), cfWorkUnit555));
			sheet11.addCell(new Label(5, 16, this.getBasicInfoModel()
					.getXkje3()
					+ "/" + this.getBasicInfoModel().getTc3(), cfWorkUnit555));
			sheet11.addCell(new Label(5, 17, this.getBasicInfoModel()
					.getXkje4()
					+ "/" + this.getBasicInfoModel().getTc4(), cfWorkUnit555));
			sheet11.addCell(new Label(5, 18, this.getBasicInfoModel()
					.getXkje5()
					+ "/" + this.getBasicInfoModel().getTc5(), cfWorkUnit555));
			sheet11.addCell(new Label(5, 19, this.getBasicInfoModel()
					.getXkje6()
					+ "/" + this.getBasicInfoModel().getTc6(), cfWorkUnit555));
			// 百分号后面的
			// sheet11.addCell(new Label(6, 14, "/"
			// + this.getBasicInfoModel().getTc1(), cfWorkUnit555));
			// sheet11.addCell(new Label(6, 15, "/"
			// + this.getBasicInfoModel().getTc2(), cfWorkUnit555));
			// sheet11.addCell(new Label(6, 16, "/"
			// + this.getBasicInfoModel().getTc3(), cfWorkUnit555));
			// sheet11.addCell(new Label(6, 17, "/"
			// + this.getBasicInfoModel().getTc4(), cfWorkUnit555));
			// sheet11.addCell(new Label(6, 18, "/"
			// + this.getBasicInfoModel().getTc5(), cfWorkUnit555));
			// sheet11.addCell(new Label(6, 19, "/"
			// + this.getBasicInfoModel().getTc6(), cfWorkUnit555));
			// sheet11.addCell(new Label(6, 20, "/"
			// + this.getBasicInfoModel().getTc6(), cfWorkUnit555));
			// 合同名称
			sheet11.addCell(new Label(7, 13, this.getBasicInfoModel()
					.getHtlxmc1(), cfWorkUnit53));
			sheet11.addCell(new Label(7, 14, this.getBasicInfoModel()
					.getHtlxmc2(), cfWorkUnit53));
			sheet11.addCell(new Label(7, 15, this.getBasicInfoModel()
					.getHtlxmc3(), cfWorkUnit53));
			sheet11.addCell(new Label(7, 16, this.getBasicInfoModel()
					.getHtlxmc4(), cfWorkUnit53));
			sheet11.addCell(new Label(7, 17, this.getBasicInfoModel()
					.getHtlxmc5(), cfWorkUnit53));
			sheet11.addCell(new Label(7, 18, this.getBasicInfoModel()
					.getHtlxmc6(), cfWorkUnit53));
			sheet11.addCell(new Label(7, 19, this.getBasicInfoModel()
					.getHtlxmc6(), cfWorkUnit53));

			// 国家地区
			sheet11.addCell(new Label(1, 21, this.getBasicInfoModel()
					.getAreamc1(), cfWorkUnit53));
			sheet11.addCell(new Label(1, 22, this.getBasicInfoModel()
					.getAreamc2(), cfWorkUnit53));
			sheet11.addCell(new Label(1, 23, this.getBasicInfoModel()
					.getAreamc3(), cfWorkUnit53));
			sheet11.addCell(new Label(1, 24, this.getBasicInfoModel()
					.getAreamc4(), cfWorkUnit53));
			sheet11.addCell(new Label(1, 25, this.getBasicInfoModel()
					.getAreamc5(), cfWorkUnit53));
			sheet11.addCell(new Label(1, 26, this.getBasicInfoModel()
					.getAreamc6(), cfWorkUnit53));
			// 申请时间
			sheet11.addCell(new Label(3, 21, this.getBasicInfoModel()
					.getSqrq1(), cfWorkUnit53));
			sheet11.addCell(new Label(3, 22, this.getBasicInfoModel()
					.getSqrq2(), cfWorkUnit53));
			sheet11.addCell(new Label(3, 23, this.getBasicInfoModel()
					.getSqrq3(), cfWorkUnit53));
			sheet11.addCell(new Label(3, 24, this.getBasicInfoModel()
					.getSqrq4(), cfWorkUnit53));
			sheet11.addCell(new Label(3, 25, this.getBasicInfoModel()
					.getSqrq5(), cfWorkUnit53));
			sheet11.addCell(new Label(3, 26, this.getBasicInfoModel()
					.getSqrq6(), cfWorkUnit53));

			// 法律状态

			sheet11.addCell(new Label(5, 21, this.getBasicInfoModel()
					.getFlztmc1(), cfWorkUnit54));
			sheet11.addCell(new Label(5, 22, this.getBasicInfoModel()
					.getFlztmc2(), cfWorkUnit54));
			sheet11.addCell(new Label(5, 23, this.getBasicInfoModel()
					.getFlztmc3(), cfWorkUnit54));
			sheet11.addCell(new Label(5, 24, this.getBasicInfoModel()
					.getFlztmc4(), cfWorkUnit54));
			sheet11.addCell(new Label(5, 25, this.getBasicInfoModel()
					.getFlztmc5(), cfWorkUnit54));
			sheet11.addCell(new Label(5, 26, this.getBasicInfoModel()
					.getFlztmc6(), cfWorkUnit54));
			/*******************************************************************
			 * 对第六个表(分表)（分表一）
			 */
			WritableSheet sheet6 = book.getSheet(5);
			jxl.format.CellFormat cfWorkUnit11 = sheet6.getCell(2, 4)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit12 = sheet6.getCell(7, 4)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit13 = sheet6.getCell(0, 7)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit14 = sheet6.getCell(0, 12)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit15 = sheet6.getCell(0, 20)
					.getCellFormat();
			
			jxl.format.CellFormat cfWorkUnit701 = sheet6.getCell(2, 27)
			.getCellFormat();
			
			jxl.format.CellFormat cfWorkUnit702 = sheet6.getCell(6, 27)
			.getCellFormat();
			
			this.setJjxyInfoModel(this.getJjxyInfoService().findJjxyByZlId(
					zlid, "0"));

			// 总投资
			sheet6.addCell(new Label(2, 4, StringUtils.doubleToString(this
					.getJjxyInfoModel().getZtz()), cfWorkUnit11));
			// 实施单位
			sheet6.addCell(new Label(6, 3, this.getJjxyInfoModel().getSsdw(),
					cfWorkUnit11));
			// 回收期
			sheet6.addCell(new Label(7, 4, this.getJjxyInfoModel().getHsq(),
					cfWorkUnit12));
			// 年度
			sheet6.addCell(new Label(0, 7, this.getJjxyInfoModel().getNd1(),
					cfWorkUnit13));
			sheet6.addCell(new Label(0, 8, this.getJjxyInfoModel().getNd2(),
					cfWorkUnit13));
			sheet6.addCell(new Label(0, 9, this.getJjxyInfoModel().getNd3(),
					cfWorkUnit13));
			// 新增税额
			sheet6.addCell(new Label(1, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse1()), cfWorkUnit12));
			sheet6.addCell(new Label(1, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse2()), cfWorkUnit12));
			sheet6.addCell(new Label(1, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse3()), cfWorkUnit12));
			sheet6.addCell(new Label(1, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse4()), cfWorkUnit12)); // 新增利润

			sheet6.addCell(new Label(3, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr1()), cfWorkUnit13));
			sheet6.addCell(new Label(3, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr2()), cfWorkUnit13));
			sheet6.addCell(new Label(3, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr3()), cfWorkUnit13));
			sheet6.addCell(new Label(3, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr4()), cfWorkUnit13));

			// 新增税收
			sheet6.addCell(new Label(4, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss1()), cfWorkUnit13));
			sheet6.addCell(new Label(4, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss2()), cfWorkUnit13));
			sheet6.addCell(new Label(4, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss3()), cfWorkUnit13));
			sheet6.addCell(new Label(4, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss4()), cfWorkUnit13));

			// 创收外汇、
			sheet6.addCell(new Label(5, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh1()), cfWorkUnit12));
			sheet6.addCell(new Label(5, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh2()), cfWorkUnit12));
			sheet6.addCell(new Label(5, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh3()), cfWorkUnit12));
			sheet6.addCell(new Label(5, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh4()), cfWorkUnit12));

			// 节支总额
			sheet6.addCell(new Label(7, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje1()), cfWorkUnit12));
			sheet6.addCell(new Label(7, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje2()), cfWorkUnit12));
			sheet6.addCell(new Label(7, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje3()), cfWorkUnit12));
			sheet6.addCell(new Label(7, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje4()), cfWorkUnit12));

			// 计算依据
			sheet6.addCell(new Label(0, 12, this.getJjxyInfoModel().getJsyj(),
					cfWorkUnit14));
			// 社会效益
			sheet6.addCell(new Label(0, 20, this.getJjxyInfoModel().getShxy(),
					cfWorkUnit15));
			// 填表人
			sheet6.addCell(new Label(2, 27, this.getJjxyInfoModel().getTbr(),
					cfWorkUnit701));
			// 联系电话
			sheet6.addCell(new Label(6, 27, this.getJjxyInfoModel().getLxdh(),
					cfWorkUnit702));
			/*******************************************************************
			 * 对第7个表（分表二）
			 */
			this.setJjxyInfoModel(this.getJjxyInfoService().findJjxyByZlId(
					zlid, "2"));
			WritableSheet sheet7 = book.getSheet(6);
			
			jxl.format.CellFormat cfWorkUnit117 = sheet7.getCell(1, 28)
			.getCellFormat();
			jxl.format.CellFormat cfWorkUnit200 = sheet7.getCell(0, 12)
			.getCellFormat();
			jxl.format.CellFormat cfWorkUnit201 = sheet7.getCell(0, 20)
			.getCellFormat();
			
			jxl.format.CellFormat cfWorkUnit703 = sheet7.getCell(2, 27)
			.getCellFormat();
			
			jxl.format.CellFormat cfWorkUnit704 = sheet7.getCell(6, 27)
			.getCellFormat();
			
			// 总投资
			sheet7.addCell(new Label(2, 4, StringUtils.doubleToString(this
					.getJjxyInfoModel().getZtz()), cfWorkUnit11));
			// 实施单位
			sheet7.addCell(new Label(6, 3, this.getJjxyInfoModel().getSsdw(),
					cfWorkUnit11));
			// 回收期
			sheet7.addCell(new Label(7, 4, this.getJjxyInfoModel().getHsq(),
					cfWorkUnit12));
			// 年度
			sheet7.addCell(new Label(0, 7, this.getJjxyInfoModel().getNd1(),
					cfWorkUnit13));
			sheet7.addCell(new Label(0, 8, this.getJjxyInfoModel().getNd2(),
					cfWorkUnit13));
			sheet7.addCell(new Label(0, 9, this.getJjxyInfoModel().getNd3(),
					cfWorkUnit13));
			// 新增税额
			sheet7.addCell(new Label(1, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse1()), cfWorkUnit12));
			sheet7.addCell(new Label(1, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse1()), cfWorkUnit12));
			sheet7.addCell(new Label(1, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse1()), cfWorkUnit12));
			sheet7.addCell(new Label(1, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse1()), cfWorkUnit12));
			// 新增利润
			sheet7.addCell(new Label(3, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr1()), cfWorkUnit13));
			sheet7.addCell(new Label(3, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr2()), cfWorkUnit13));
			sheet7.addCell(new Label(3, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr3()), cfWorkUnit13));
			sheet7.addCell(new Label(3, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr4()), cfWorkUnit13));
			// 新增税收
			sheet7.addCell(new Label(4, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss1()), cfWorkUnit13));
			sheet7.addCell(new Label(4, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss2()), cfWorkUnit13));
			sheet7.addCell(new Label(4, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss3()), cfWorkUnit13));
			sheet7.addCell(new Label(4, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss4()), cfWorkUnit13));
			// 创收外汇、
			sheet7.addCell(new Label(5, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh1()), cfWorkUnit12));
			sheet7.addCell(new Label(5, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh2()), cfWorkUnit12));
			sheet7.addCell(new Label(5, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh3()), cfWorkUnit12));
			sheet7.addCell(new Label(5, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh4()), cfWorkUnit12));
			// 节支总额
			sheet7.addCell(new Label(7, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje1()), cfWorkUnit12));
			sheet7.addCell(new Label(7, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje2()), cfWorkUnit12));
			sheet7.addCell(new Label(7, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje3()), cfWorkUnit12));
			sheet7.addCell(new Label(7, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje4()), cfWorkUnit12));
			// 计算依据
			sheet7.addCell(new Label(0, 12, this.getJjxyInfoModel().getJsyj(),
					cfWorkUnit200));
			// 社会效益
			sheet7.addCell(new Label(0, 20, this.getJjxyInfoModel().getShxy(),
					cfWorkUnit201));
			// 填表人
			sheet7.addCell(new Label(2, 27, this.getJjxyInfoModel().getTbr(),
					cfWorkUnit703));
			// 联系电话
			sheet7.addCell(new Label(6, 27, this.getJjxyInfoModel().getLxdh(),
					cfWorkUnit704));
			/*******************************************************************
			 * 对第8个表（分表3）
			 */
			this.setJjxyInfoModel(this.getJjxyInfoService().findJjxyByZlId(
					zlid, "3"));
			WritableSheet sheet8 = book.getSheet(7);
			
			jxl.format.CellFormat cfWorkUnit705 = sheet7.getCell(2, 27)
			.getCellFormat();
			
			jxl.format.CellFormat cfWorkUnit706 = sheet7.getCell(6, 27)
			.getCellFormat();
			
			jxl.format.CellFormat cfWorkUnit202 = sheet8.getCell(0, 12)
			.getCellFormat();
			
			jxl.format.CellFormat cfWorkUnit203 = sheet8.getCell(0, 20)
			.getCellFormat();
			
			// 总投资
			sheet8.addCell(new Label(2, 4, StringUtils.doubleToString(this
					.getJjxyInfoModel().getZtz()), cfWorkUnit11));
			// 实施单位
			sheet8.addCell(new Label(6, 3, this.getJjxyInfoModel().getSsdw(),
					cfWorkUnit11));
			// 回收期
			sheet8.addCell(new Label(7, 4, this.getJjxyInfoModel().getHsq(),
					cfWorkUnit12));
			// 年度
			sheet8.addCell(new Label(0, 7, this.getJjxyInfoModel().getNd1(),
					cfWorkUnit13));
			sheet8.addCell(new Label(0, 8, this.getJjxyInfoModel().getNd2(),
					cfWorkUnit13));
			sheet8.addCell(new Label(0, 9, this.getJjxyInfoModel().getNd3(),
					cfWorkUnit13));
			// 新增税额
			sheet8.addCell(new Label(1, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse1()), cfWorkUnit12));
			sheet8.addCell(new Label(1, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse1()), cfWorkUnit12));
			sheet8.addCell(new Label(1, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse1()), cfWorkUnit12));
			sheet8.addCell(new Label(1, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse1()), cfWorkUnit12));
			// 新增利润
			sheet8.addCell(new Label(3, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr1()), cfWorkUnit13));
			sheet8.addCell(new Label(3, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr2()), cfWorkUnit13));
			sheet8.addCell(new Label(3, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr3()), cfWorkUnit13));
			sheet8.addCell(new Label(3, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr4()), cfWorkUnit13));
			// 新增税收
			sheet8.addCell(new Label(4, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss1()), cfWorkUnit13));
			sheet8.addCell(new Label(4, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss2()), cfWorkUnit13));
			sheet8.addCell(new Label(4, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss3()), cfWorkUnit13));
			sheet8.addCell(new Label(4, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss4()), cfWorkUnit13));
			// 创收外汇、
			sheet8.addCell(new Label(5, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh1()), cfWorkUnit12));
			sheet8.addCell(new Label(5, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh2()), cfWorkUnit12));
			sheet8.addCell(new Label(5, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh3()), cfWorkUnit12));
			sheet8.addCell(new Label(5, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh4()), cfWorkUnit12));
			// 节支总额
			sheet8.addCell(new Label(7, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje1()), cfWorkUnit12));
			sheet8.addCell(new Label(7, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje2()), cfWorkUnit12));
			sheet8.addCell(new Label(7, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje3()), cfWorkUnit12));
			sheet8.addCell(new Label(7, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje4()), cfWorkUnit12));
			// 计算依据
			sheet8.addCell(new Label(0, 12, this.getJjxyInfoModel().getJsyj(),
					cfWorkUnit202));
			// 社会效益
			sheet8.addCell(new Label(0, 20, this.getJjxyInfoModel().getShxy(),
					cfWorkUnit203));
			// 填表人
			sheet8.addCell(new Label(2, 27, this.getJjxyInfoModel().getTbr(),
					cfWorkUnit705));
			// 联系电话
			sheet8.addCell(new Label(6, 27, this.getJjxyInfoModel().getLxdh(),
					cfWorkUnit706));
			/*******************************************************************
			 * 对第9个表（分表4）
			 */
			this.setJjxyInfoModel(this.getJjxyInfoService().findJjxyByZlId(
					zlid, "4"));
			WritableSheet sheet9 = book.getSheet(6);
			
			jxl.format.CellFormat cfWorkUnit204 = sheet9.getCell(0, 12)
			.getCellFormat();
			jxl.format.CellFormat cfWorkUnit205 = sheet9.getCell(0, 20)
			.getCellFormat();
			
			jxl.format.CellFormat cfWorkUnit707 = sheet7.getCell(2, 27)
			.getCellFormat();
			
			jxl.format.CellFormat cfWorkUnit708 = sheet7.getCell(6, 27)
			.getCellFormat();
			
			
			// 总投资
			sheet9.addCell(new Label(2, 4, StringUtils.doubleToString(this
					.getJjxyInfoModel().getZtz()), cfWorkUnit11));
			// 实施单位
			sheet9.addCell(new Label(6, 3, this.getJjxyInfoModel().getSsdw(),
					cfWorkUnit11));
			// 回收期
			sheet9.addCell(new Label(7, 4, this.getJjxyInfoModel().getHsq(),
					cfWorkUnit12));
			// 年度
			sheet9.addCell(new Label(0, 7, this.getJjxyInfoModel().getNd1(),
					cfWorkUnit13));
			sheet9.addCell(new Label(0, 8, this.getJjxyInfoModel().getNd2(),
					cfWorkUnit13));
			sheet9.addCell(new Label(0, 9, this.getJjxyInfoModel().getNd3(),
					cfWorkUnit13));
			// 新增税额
			sheet9.addCell(new Label(1, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse1()), cfWorkUnit12));
			sheet9.addCell(new Label(1, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse1()), cfWorkUnit12));
			sheet9.addCell(new Label(1, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse1()), cfWorkUnit12));
			sheet9.addCell(new Label(1, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse1()), cfWorkUnit12));
			// 新增利润
			sheet9.addCell(new Label(3, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr1()), cfWorkUnit13));
			sheet9.addCell(new Label(3, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr2()), cfWorkUnit13));
			sheet9.addCell(new Label(3, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr3()), cfWorkUnit13));
			sheet9.addCell(new Label(3, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr4()), cfWorkUnit13));
			// 新增税收
			sheet9.addCell(new Label(4, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss1()), cfWorkUnit13));
			sheet9.addCell(new Label(4, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss2()), cfWorkUnit13));
			sheet9.addCell(new Label(4, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss3()), cfWorkUnit13));
			sheet9.addCell(new Label(4, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss4()), cfWorkUnit13));
			// 创收外汇、
			sheet9.addCell(new Label(5, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh1()), cfWorkUnit12));
			sheet9.addCell(new Label(5, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh2()), cfWorkUnit12));
			sheet9.addCell(new Label(5, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh3()), cfWorkUnit12));
			sheet9.addCell(new Label(5, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh4()), cfWorkUnit12));
			// 节支总额
			sheet9.addCell(new Label(7, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje1()), cfWorkUnit12));
			sheet9.addCell(new Label(7, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje2()), cfWorkUnit12));
			sheet9.addCell(new Label(7, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje3()), cfWorkUnit12));
			sheet9.addCell(new Label(7, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje4()), cfWorkUnit12));
			// 计算依据
			sheet9.addCell(new Label(0, 12, this.getJjxyInfoModel().getJsyj(),
					cfWorkUnit204));
			// 社会效益
			sheet9.addCell(new Label(0, 20, this.getJjxyInfoModel().getShxy(),
					cfWorkUnit205));
			// 填表人
			sheet9.addCell(new Label(2, 27, this.getJjxyInfoModel().getTbr(),
					cfWorkUnit707));
			// 联系电话
			sheet9.addCell(new Label(6, 27, this.getJjxyInfoModel().getLxdh(),
					cfWorkUnit708));
			/*******************************************************************
			 * 对第10个表（分表5）
			 */
			this.setJjxyInfoModel(this.getJjxyInfoService().findJjxyByZlId(
					zlid, "5"));
			WritableSheet sheet10 = book.getSheet(7);
			
			jxl.format.CellFormat cfWorkUnit207 = sheet10.getCell(0, 12)
			.getCellFormat();
			
			jxl.format.CellFormat cfWorkUnit208 = sheet10.getCell(0, 20)
			.getCellFormat();
			
			jxl.format.CellFormat cfWorkUnit709 = sheet7.getCell(2, 27)
			.getCellFormat();
			
			jxl.format.CellFormat cfWorkUnit710 = sheet7.getCell(6, 27)
			.getCellFormat();
			
			
			// 总投资
			sheet10.addCell(new Label(2, 4, StringUtils.doubleToString(this
					.getJjxyInfoModel().getZtz()), cfWorkUnit11));
			// 实施单位
			sheet10.addCell(new Label(6, 3, this.getJjxyInfoModel().getSsdw(),
					cfWorkUnit11));
			// 回收期
			sheet10.addCell(new Label(7, 4, this.getJjxyInfoModel().getHsq(),
					cfWorkUnit12));
			// 年度
			sheet10.addCell(new Label(0, 7, this.getJjxyInfoModel().getNd1(),
					cfWorkUnit13));
			sheet10.addCell(new Label(0, 8, this.getJjxyInfoModel().getNd2(),
					cfWorkUnit13));
			sheet10.addCell(new Label(0, 9, this.getJjxyInfoModel().getNd3(),
					cfWorkUnit13));
			// 新增税额
			sheet10.addCell(new Label(1, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse1()), cfWorkUnit12));
			sheet10.addCell(new Label(1, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse1()), cfWorkUnit12));
			sheet10.addCell(new Label(1, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse1()), cfWorkUnit12));
			sheet10.addCell(new Label(1, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse1()), cfWorkUnit12));
			// 新增利润
			sheet10.addCell(new Label(3, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr1()), cfWorkUnit13));
			sheet10.addCell(new Label(3, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr2()), cfWorkUnit13));
			sheet10.addCell(new Label(3, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr3()), cfWorkUnit13));
			sheet10.addCell(new Label(3, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr4()), cfWorkUnit13));
			// 新增税收
			sheet10.addCell(new Label(4, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss1()), cfWorkUnit13));
			sheet10.addCell(new Label(4, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss2()), cfWorkUnit13));
			sheet10.addCell(new Label(4, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss3()), cfWorkUnit13));
			sheet10.addCell(new Label(4, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss4()), cfWorkUnit13));
			// 创收外汇、
			sheet10.addCell(new Label(5, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh1()), cfWorkUnit12));
			sheet10.addCell(new Label(5, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh2()), cfWorkUnit12));
			sheet10.addCell(new Label(5, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh3()), cfWorkUnit12));
			sheet10.addCell(new Label(5, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh4()), cfWorkUnit12));
			// 节支总额
			sheet10.addCell(new Label(7, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje1()), cfWorkUnit12));
			sheet10.addCell(new Label(7, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje2()), cfWorkUnit12));
			sheet10.addCell(new Label(7, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje3()), cfWorkUnit12));
			sheet10.addCell(new Label(7, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje4()), cfWorkUnit12));
			// 计算依据
			sheet10.addCell(new Label(0, 12, this.getJjxyInfoModel().getJsyj(),
					cfWorkUnit207));
			// 社会效益
			sheet10.addCell(new Label(0, 20, this.getJjxyInfoModel().getShxy(),
					cfWorkUnit208));
			// 填表人
			sheet10.addCell(new Label(2, 27, this.getJjxyInfoModel().getTbr(),
					cfWorkUnit709));
			// 联系电话
			sheet10.addCell(new Label(6, 27, this.getJjxyInfoModel().getLxdh(),
					cfWorkUnit710));
			/*******************************************************************
			 * 对第五个表（经济效益总表续）
			 */
			this.setJjxyInfoModel(this.getJjxyInfoService().findJjxyByZlId(
					zlid, "1"));
			WritableSheet sheet5 = book.getSheet(4);
			jxl.format.CellFormat cfWorkUnit9 = sheet5.getCell(0, 4)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit10 = sheet5.getCell(0, 17)
					.getCellFormat();
			sheet5.addCell(new Label(0, 4, this.getJjxyInfoModel().getSsqk(),
					cfWorkUnit9));
			sheet5.addCell(new Label(0, 17, this.getJjxyInfoModel().getShxy(),
					cfWorkUnit10));
			/**
			 * 针对专利技术状况
			 */

			this.setZljszkModel(this.getZljszkService().findZljszkByZlId(zlid));
			WritableSheet sheet = book.getSheet(2);
			// 第一列 第24行第一个样式(年度)
			jxl.format.CellFormat cfWorkUnit = sheet.getWritableCell(0, 23)
					.getCellFormat();
			// 第二个样式（颁奖部门）
			jxl.format.CellFormat cfWorkUnit1 = sheet.getWritableCell(2, 23)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit2 = sheet.getWritableCell(0, 4)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit000 = sheet.getWritableCell(5, 23)
			.getCellFormat();
			/**
			 * 窗体内容
			 */
			sheet.addCell(new Label(0, 4, this.getZljszkModel().getZjjsinfo(),
					cfWorkUnit2));

			/**
			 * 年度
			 */
			sheet.addCell(new Label(0, 23, this.getZljszkModel().getNd1()
					+ "年度", cfWorkUnit));
			sheet.addCell(new Label(0, 25, this.getZljszkModel().getNd2()
					+ "年度", cfWorkUnit));
			sheet.addCell(new Label(0, 27, this.getZljszkModel().getNd3()
					+ "年度", cfWorkUnit));
			sheet.addCell(new Label(0, 29, this.getZljszkModel().getNd4()
					+ "年度", cfWorkUnit));
			/**
			 * 颁奖部门
			 */
			sheet.addCell(new Label(2, 23, this.getZljszkModel().getBjbm1(),
					cfWorkUnit1));
			sheet.addCell(new Label(2, 25, this.getZljszkModel().getBjbm2(),
					cfWorkUnit1));
			sheet.addCell(new Label(2, 27, this.getZljszkModel().getBjbm3(),
					cfWorkUnit1));
			sheet.addCell(new Label(2, 29, this.getZljszkModel().getBjbm4(),
					cfWorkUnit1));
			/**
			 * 获奖名称
			 */
			sheet.addCell(new Label(5, 23, this.getZljszkModel().getHjmc1(),
					cfWorkUnit000));
			sheet.addCell(new Label(5, 25, this.getZljszkModel().getHjmc2(),
					cfWorkUnit000));
			sheet.addCell(new Label(5, 27, this.getZljszkModel().getHjmc3(),
					cfWorkUnit000));
			sheet.addCell(new Label(5, 29, this.getZljszkModel().getHjmc4(),
					cfWorkUnit000));
			/**
			 * 获奖等级
			 */
			sheet.addCell(new Label(7, 23, this.getZljszkModel().getHjdj1(),
					cfWorkUnit000));
			sheet.addCell(new Label(7, 23, this.getZljszkModel().getHjdj2(),
					cfWorkUnit000));
			sheet.addCell(new Label(7, 23, this.getZljszkModel().getHjdj3(),
					cfWorkUnit000));
			sheet.addCell(new Label(7, 23, this.getZljszkModel().getHjdj4(),
					cfWorkUnit000));
			/*******************************************************************
			 * 对第四个表（经济效益总表一）
			 */
			this.setJjxyInfoModel(this.getJjxyInfoService().findJjxyByZlId(
					zlid, "1"));
			// System.out.println(this.getJjxyInfoModel().getNd2());
			WritableSheet sheet3 = book.getSheet(3);
			// 单元格格式
			jxl.format.CellFormat cfWorkUnit3 = sheet3.getWritableCell(2, 4)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit4 = sheet3.getWritableCell(7, 4)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit5 = sheet3.getWritableCell(0, 7)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit6 = sheet3.getWritableCell(1, 7)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit6666 = sheet3.getWritableCell(2, 27)
			.getCellFormat();
			jxl.format.CellFormat cfWorkUnit7 = sheet3.getWritableCell(0, 12)
					.getCellFormat();
			jxl.format.CellFormat cfWorkUnit8 = sheet3.getWritableCell(5, 27)
					.getCellFormat();
			// 添加总投资
			sheet3.addCell(new Label(2, 4, StringUtils.doubleToString(this
					.getJjxyInfoModel().getZtz()), cfWorkUnit3));
			// 添加回收期
			sheet3.addCell(new Label(7, 4, this.getJjxyInfoModel().getHsq(),
					cfWorkUnit4));
			// 添加年度
			sheet3.addCell(new Label(0, 7, this.getJjxyInfoModel().getNd1(),
					cfWorkUnit5));
			sheet3.addCell(new Label(0, 8, this.getJjxyInfoModel().getNd2(),
					cfWorkUnit5));
			sheet3.addCell(new Label(0, 9, this.getJjxyInfoModel().getNd3(),
					cfWorkUnit5));
			// 添加新增销售额
			sheet3.addCell(new Label(1, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse1()), cfWorkUnit6));
			sheet3.addCell(new Label(1, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse2()), cfWorkUnit6));
			sheet3.addCell(new Label(1, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse3()), cfWorkUnit6));
			sheet3.addCell(new Label(1, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzxse4()), cfWorkUnit6));
			// 添加新增利润
			sheet3.addCell(new Label(3, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr1()), cfWorkUnit5));
			sheet3.addCell(new Label(3, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr2()), cfWorkUnit5));
			sheet3.addCell(new Label(3, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr3()), cfWorkUnit5));
			sheet3.addCell(new Label(3, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzlr4()), cfWorkUnit5));

			// 添加新增税收
			sheet3.addCell(new Label(4, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss1()), cfWorkUnit5));
			sheet3.addCell(new Label(4, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss2()), cfWorkUnit5));
			sheet3.addCell(new Label(4, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss3()), cfWorkUnit5));
			sheet3.addCell(new Label(4, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getXzss4()), cfWorkUnit5));

			// 创收外汇
			sheet3.addCell(new Label(5, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh1()), cfWorkUnit6));
			sheet3.addCell(new Label(5, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh2()), cfWorkUnit6));
			sheet3.addCell(new Label(5, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh3()), cfWorkUnit6));
			sheet3.addCell(new Label(5, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getCswh4()), cfWorkUnit6));

			// 节支总额
			sheet3.addCell(new Label(7, 7, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje1()), cfWorkUnit6));
			sheet3.addCell(new Label(7, 8, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje2()), cfWorkUnit6));
			sheet3.addCell(new Label(7, 9, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje3()), cfWorkUnit6));
			sheet3.addCell(new Label(7, 10, StringUtils.doubleToString(this
					.getJjxyInfoModel().getJzje4()), cfWorkUnit6));
			// 计算依据
			sheet3.addCell(new Label(0, 12, this.getJjxyInfoModel().getJsyj(),
					cfWorkUnit7));
			// 填表人
			sheet3.addCell(new Label(2, 27, this.getJjxyInfoModel().getTbr(),
					cfWorkUnit6666));
			// 电话
			sheet3.addCell(new Label(5, 27, this.getJjxyInfoModel().getLxdh(),
					cfWorkUnit8));
			// 财务章
			book.write();
			book.close();
			rwb.close();
			InputStream inputStream = new FileInputStream(exportFile);
			BasicInfoModel baseInfoModel2 = this.getBasicInfoService()
					.findBasicinfoById(zlid);
			fileName = baseInfoModel2.getName() + ".xls";
			this.setFileName(fileName);
			this.setTargetFile(inputStream);
		} catch (Exception e) {
			System.out.println(e + "文件写过程错误，导出EXCEL失败");
			return INPUT;
		}
		// finally {
		// InputStream inputStream = new FileInputStream(exportFile);
		// BasicInfoModel baseInfoModel2 = this.getBasicInfoService()
		// .findBasicinfoById(zlid);
		// fileName = baseInfoModel2.getName() + ".xls";
		// this.setFileName(fileName);
		// this.setTargetFile(inputStream);
		// }
		return SUCCESS;
	}

	public BasicInfoModel getBasicInfoModel() {
		return basicInfoModel;
	}

	public void setBasicInfoModel(BasicInfoModel basicInfoModel) {
		this.basicInfoModel = basicInfoModel;
	}

	public IBasicInfoService getBasicInfoService() {
		return basicInfoService;
	}

	public void setBasicInfoService(IBasicInfoService basicInfoService) {
		this.basicInfoService = basicInfoService;
	}

	public ZlbhzkModel getZlbhzkModel() {
		return zlbhzkModel;
	}

	public void setZlbhzkModel(ZlbhzkModel zlbhzkModel) {
		this.zlbhzkModel = zlbhzkModel;
	}

	public IZlbhzkService getZlbhzkService() {
		return zlbhzkService;
	}

	public void setZlbhzkService(IZlbhzkService zlbhzkService) {
		this.zlbhzkService = zlbhzkService;
	}

	public QtzkModel getQtzkModel() {
		return qtzkModel;
	}

	public void setQtzkModel(QtzkModel qtzkModel) {
		this.qtzkModel = qtzkModel;
	}

	public IQtzkService getQtzkService() {
		return qtzkService;
	}

	public void setQtzkService(IQtzkService qtzkService) {
		this.qtzkService = qtzkService;
	}

	public ISharePeopleService getSharePeoopleService() {
		return sharePeoopleService;
	}

	public void setSharePeoopleService(ISharePeopleService sharePeoopleService) {
		this.sharePeoopleService = sharePeoopleService;
	}

	public SharePeopleModel getSharePeopleModel() {
		return sharePeopleModel;
	}

	public void setSharePeopleModel(SharePeopleModel sharePeopleModel) {
		this.sharePeopleModel = sharePeopleModel;
	}

	public ZjclModel getZjclModel() {
		return zjclModel;
	}

	public void setZjclModel(ZjclModel zjclModel) {
		this.zjclModel = zjclModel;
	}

	public IZjclService getZjclService() {
		return zjclService;
	}

	public void setZjclService(IZjclService zjclService) {
		this.zjclService = zjclService;
	}

	public IPatentManageService getPatentManageService() {
		return patentManageService;
	}

	public void setPatentManageService(IPatentManageService patentManageService) {
		this.patentManageService = patentManageService;
	}

	public TjyjModel getTjyjModel() {
		return tjyjModel;
	}

	public void setTjyjModel(TjyjModel tjyjModel) {
		this.tjyjModel = tjyjModel;
	}

	public ZlIntroModel getZlIntroModel() {
		return zlIntroModel;
	}

	public void setZlIntroModel(ZlIntroModel zlIntroModel) {
		this.zlIntroModel = zlIntroModel;
	}

	public IZlIntroService getZlIntroService() {
		return zlIntroService;
	}

	public void setZlIntroService(IZlIntroService zlIntroService) {
		this.zlIntroService = zlIntroService;
	}

	public String getExcelPath() {
		return excelPath;
	}

	public void setExcelPath(String excelPath) {
		this.excelPath = excelPath;
	}

	public String getFileName() {
		try {
			fileName = java.net.URLEncoder.encode(fileName, "UTF-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public InputStream getTargetFile() {
		return targetFile;
	}

	public void setTargetFile(InputStream targetFile) {
		this.targetFile = targetFile;
	}
}
